package com.zrrd.learn.framework.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;

/**
 * @author wrn
 * @version 1.0
 * @date 2023/9/14 16:18
 */
@Component
@Aspect
@EnableAspectJAutoProxy
public class MyAop {

//    @After()
//    @Before()
//    @Around()
//    @AfterReturning
//    @AfterThrowing

    @Around("execution(public * com.zrrd.learn.framework.aop.MyTarget.add())")
    public Object say(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("我在之前");
        Object obj = pjp.proceed();
        System.out.println("我在之后");
        return obj;
    }

}
